
// Get pixel dimensions of screen
export function getDimensions () {
  let winW = 630
  let winH = 460
  if (document.body && document.body.offsetWidth) {
    winW = document.body.offsetWidth
    winH = document.body.offsetHeight
  }
  if (document.compatMode === 'CSS1Compat' && document.documentElement && document.documentElement.offsetWidth) {
    winW = document.documentElement.offsetWidth
    winH = document.documentElement.offsetHeight
  }
  if (window.innerWidth && window.innerHeight) {
    winW = window.innerWidth
    winH = window.innerHeight
  }
  return {
    'width': winW,
    'height': winH
  }
}
// Get the location of element
export function getOffsetRight (elem) {
  let element = elem
  let width = element.offsetWidth
  let right = 0
  while (element.offsetParent) {
    right += element.offsetLeft
    element = element.offsetParent
  }
  right += element.offsetLeft
  right = getDimensions()['width'] - right
  right -= width
  return right
}
